	
<?php	
	require("libraries/CostLib.php");
	require 'libraries/UserLibrary.php';
	session_start();
//	if((!isset($_SESSION['mainType']) && (!isset($_SESSION['subType'])))){
//		header("Location: ViewAnalysisCosts.php");
//	}
	checkSessionVariable("administrator", "AdministratorHomepage.php", NULL);

	$mainType = $_GET['mainType'];
	$subType = $_GET['subType'];
	$_SESSION['mainType'] =  $_GET['mainType'];
	$_SESSION['subType'] = $_GET['subType'];

?>	
<html>
<head>
	<title>Edit Cost Success</title>
</head>
<body>
	<hr/>
	<?php if(isset($_GET['success'])){?>
		<h4>Cost Successfully Updated!</h4><br/><br/>
	<?php } ?>
	<center>
	<form name="viewCost" method="POST">
		<table border='0'>
			<tr>
			<th>ANALYSIS CATEGORY</th>
			<th>ANALYSIS COMPONENT</th>
			<th>COST</th>
			
			<th></th>
			</tr>	
			<?php
			$con = mysql_connect('localhost','editcost','editcost') or die('Could not connect: ' . mysql_error());
			mysql_select_db('casl') or die(mysql_error());
			$result = getLimitedTable($mainType, $subType, "casl", "localhost", "editcost", "editcost");
			foreach ($result as $entry){
			?> 	
				<tr>
					<td><b><?php echo "$entry[1]";?></b></td>
					<td><?php echo "$entry[2]";?></td>
					<td><?php echo "$entry[3]";?></td>
				</tr>
			<?php
			}
			?>		
			</table>
		<br/>
	</form>
	</center>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<?php 
	?>
	<input type="button" value="Edit <?php echo $subType;?> Costs" onClick='document.location.href = "EditAnalysisCost.php"'>
	<input type="button" value="Back To View Tree" onClick='document.location.href = "ViewAnalysisCosts.php"'>
	<br/><br/><hr/>
</body>
</html>
